package com.bootdo.clouddo.service.douban.impl;

import com.bootdo.clouddo.dao.douban.DbSubjectCollectionMapper;
import com.bootdo.clouddo.domain.douban.DbSubjectCollection;
import com.bootdo.clouddo.service.douban.IDbSubjectCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DbSubjectCollectionServiceImpl implements IDbSubjectCollectionService {

    @Autowired
    private DbSubjectCollectionMapper dao;

    @Override
    public DbSubjectCollection findById(String id) {
        return dao.selectByPrimaryKey(id);
    }

    @Override
    public int save(DbSubjectCollection record) {
        if(findById(record.getId()) != null)
            return dao.updateByPrimaryKeySelective(record);
        return dao.insertSelective(record);
    }
}
